/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <cstdio>

using namespace std;

int main_1008()
{
    int N,M;
    scanf("%d%d",&N,&M);
    int A[N]={0},B[N]={0};
    //input
    for (int i=0;i<N ;++i )
    {
        scanf("%d",&A[i]);
    }
    //move
    for (int i=0;i<N ;++i )
    {
        B[(i+M)%N]=A[i];
    }
    //output
    for (int i=0;i<(N-1) ;++i )
    {
        printf("%d ",B[i]);
    }
    printf("%d",B[N-1]);
	return 0;
}
